import { defineStore } from "pinia";
import { ref } from "vue";

export const useHistoryStore = defineStore(
  "history",
  () => {
    const historyList = ref([]);
    const addHistory = (value) => {
      historyList.value.unshift(value);
    };
    const delHistory = (index) => {
      historyList.value.splice(index, 1);
    };
    const delAll = () => {
      historyList.value = [];
    };
    return {
      historyList,
      addHistory,
      delHistory,
      delAll,
    };
  },
  { persist: true }
);
